#ifndef _MINIMAL_WS_SERVER_PMD_H__
#define _MINIMAL_WS_SERVER_PMD_H__

#include <libwebsockets.h>
#include <string.h>
#include <signal.h>
#include <pthread.h>

struct msg {
	void *payload; /* is malloc'd */
	size_t len;
};

/* one of these is created for each client connecting to us */

struct per_session_data__minimal {
	struct per_session_data__minimal *pss_list;
	struct lws *wsi;
	uint32_t tail;
};

/* one of these is created for each vhost our protocol is used with */

struct per_vhost_data__minimal {
	struct lws_context *context;
	struct lws_vhost *vhost;
	const struct lws_protocols *protocol;

	struct per_session_data__minimal *pss_list; /* linked-list of live pss*/
	pthread_t pthread_spam[2];

	pthread_mutex_t lock_ring; /* serialize access to the ring buffer */
	struct lws_ring *ring; /* {lock_ring} ringbuffer holding unsent content */

	const char *config;
	char finished;
};

void __minimal_destroy_message(void *_msg);

void *ws_main(void *arg);

/**
 *****************************************************************************************
 * @brief User dfu start.
 *****************************************************************************************
 */

#endif


